package com.ms.orm;

import com.ms.orm.annotation.DbType;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.AliasFor;

import java.lang.annotation.*;

/**
 * @author .
 * DefaultBaseService 中的方法如果需要事务，子类需要覆盖其对应方法
 * 需要开启 基于 Ciglib 的代理，
 * @EnableAspectJAutoProxy(proxyTargetClass=true)
 * 如果不开启ciglib代理，即 proxyTargetClass = true,生成的代理类是 'com.sun.proxy.$Proxy25',是实现接口BaseService，无法转换为具体的子类行，比如 UserService类型
 *
 */

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Import({EntityTableRelationRegistrar.class})
public @interface EnableLittleOrm {

    /**
     * Alias for the {@link #basePackages()} attribute. Allows for more concise annotation declarations e.g.:
     * @return base package names
     */
    @AliasFor("basePackages")
    String[] value() default {};

    /**
     * Base packages to scan for MyBatis interfaces. Note that only interfaces with at least one method will be
     * registered; concrete classes will be ignored.
     *
     * @return base package names for scanning @TableName entities
     */
    @AliasFor("value")
    String[] basePackages() default {};


    /**
     *
     * @return
     */
    DbType dbType() default DbType.MYSQL;
}
